<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>循环遍历对象</title>
		<script type="text/javascript" src="../js/angular.min.js" ></script>
	</head>
	<body ng-app="appAngular" ng-controller="appController">
		<table width="100%" border="1">
			<tr>
				<td>序号</td>
				<td>编号</td>
				<td>名字</td>
				<td>价格</td>
				
			</tr>
			
			<tr ng-repeat="product in products">
				<td>{{$index+1}}</td>
				<!-- 心累,product不用加$ -->
				<td>{{product.id}}</td>
				<td>{{product.name}}</td>
				<td>{{product.price}}</td>
				
			</tr>
			
			
			
		</table>
		
		<script >
			// 初始化angular
			var ma = angular.module("appAngular",[]);
			// 初始化控制器
			ma.controller("appController",function($scope){
				$scope.products = [
					{
						id : 1001,
						name : '狄晨琳',
						price : 688
					},
					
					{
						id : 1002,
						name : '李芳哲',
						price : 788
					}
				];
			});
		</script>
		
	</body>
</html>
